#include "server.hpp"


int main()
{
    Server server;
    server.ShmCreat();
    // sleep(5);

    char* a= (char*)server.Shmattach();
    // if (*(int*)a == -1)
    // {
    //     std::cout << "attach error" << std::endl;
    // }
    std::cout << "attach done..." << std::endl;
    // sleep(5);

    while(true)
    {
        sleep(3);
        printf("Client say# %s\n",a);
    }

    if (server.Shmdattach() == -1)
    {
        std::cout << "dattach error" << std::endl;
    }
    std::cout << "dattach done..." << std::endl;
    // sleep(5);
    
    if (server.ShmCtl() == -1)
    {
        std::cout << "destory error" << std::endl;
    }
    std::cout << "ctl sucess" << std::endl;
    return 0;
}